package cn.meibang.meibanguserandclient.provider.base;


import cn.apestar.core.base.GenericMapper;
import cn.apestar.core.base.MapperAnnotation;
import cn.meibang.meibanguserandclient.provider.domain.MeibangUserAndClient;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

/**
 * 业务管理客 Dao 层
 *
 * @author yudw
 * @version 1.0
 */

@MapperAnnotation public interface BaseMeibangUserAndClientMapper
    extends GenericMapper<MeibangUserAndClient, Long> {

    @Delete({"delete from meibang_user_and_client", "where id = #{id,jdbcType=BIGINT}"})
    int deleteByPrimaryKey(Long id);

    @Insert({"insert into meibang_user_and_client (", "master_id,", "user_id,", "reason,",
        "remark,", "create_date,", "update_date,", "create_by,", "update_by,", "del_flag",
        " )values(", "#{masterId,jdbcType=BIGINT},", "#{userId,jdbcType=BIGINT},",
        "#{reason,jdbcType=VARCHAR},", "#{remark,jdbcType=VARCHAR},",
        "#{createDate,jdbcType=DATE},", "#{updateDate,jdbcType=DATE},",
        "#{createBy,jdbcType=BIGINT},", "#{updateBy,jdbcType=BIGINT},",
        "#{delFlag,jdbcType=VARCHAR})"}) int insert(MeibangUserAndClient record);

    @InsertProvider(type = BaseMeibangUserAndClientSqlProvider.class, method = "insertSelective")
    int insertSelective(MeibangUserAndClient record);

    @Select({"select", "master_id,", "user_id,", "reason,", "remark,", "create_date,",
        "update_date,", "create_by,", "update_by,", "del_flag", "from meibang_user_and_client",
        "where id = #{id,jdbcType=BIGINT}"})
    @Results({@Result(column = "id", property = "id", jdbcType = JdbcType.BIGINT, id = true),
        @Result(column = "master_id", property = "masterId", jdbcType = JdbcType.BIGINT),
        @Result(column = "user_id", property = "userId", jdbcType = JdbcType.BIGINT),
        @Result(column = "reason", property = "reason", jdbcType = JdbcType.VARCHAR),
        @Result(column = "remark", property = "remark", jdbcType = JdbcType.VARCHAR),
        @Result(column = "create_date", property = "createDate", jdbcType = JdbcType.DATE),
        @Result(column = "update_date", property = "updateDate", jdbcType = JdbcType.DATE),
        @Result(column = "create_by", property = "createBy", jdbcType = JdbcType.BIGINT),
        @Result(column = "update_by", property = "updateBy", jdbcType = JdbcType.BIGINT),
        @Result(column = "del_flag", property = "delFlag", jdbcType = JdbcType.VARCHAR)})
    MeibangUserAndClient selectByPrimaryKey(Long id);

    @UpdateProvider(type = BaseMeibangUserAndClientSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(MeibangUserAndClient record);

    @Update({"update meibang_user_and_client", "set ", "master_id = #{masterId,jdbcType=BIGINT},",
        "user_id = #{userId,jdbcType=BIGINT},", "reason = #{reason,jdbcType=VARCHAR},",
        "remark = #{remark,jdbcType=VARCHAR},", "create_date = #{createDate,jdbcType=DATE},",
        "update_date = #{updateDate,jdbcType=DATE},", "create_by = #{createBy,jdbcType=BIGINT},",
        "update_by = #{updateBy,jdbcType=BIGINT},", "del_flag = #{delFlag,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"}) int updateByPrimaryKey(MeibangUserAndClient record);
}